import React, { useState, useEffect } from "react";
import { get } from "../../utils/request";

function index() {
  const [forum, setForum] = useState([]);
  useEffect(() => {
    get("/api/v1/posts/hot?nums=" + 20).then((res) => {
      console.log(res);
      setForum([...forum, ...res.data]);
    });
  }, []);
  return (
    <>
      {forum.map((item) => (
        <div className="item" key={item.id}>
          <h3>{item.name}</h3>
          <p>{item.desc}</p>
        </div>
      ))}
    </>
  );
}

export default index;
